package domain;

public class Day implements Comparable<Day> {
	
	private String name;
	private int range;
	
	public Day(String name, int range) {
		this.setName(name);
		this.setRange(range);
	}

	public String getName(){
		return this.name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public int getRange() {
		return range;
	}
	
	public void setRange(int range) {
		this.range = range;
	}
	
	@Override
	public boolean equals(Object o) {
		if (o == null || this.getClass() != o.getClass()) {
			return false;
		}
		if (o == this) {
			return true;
		}
		Day d = (Day) o;
		return this.getRange() == d.getRange();
	}

	@Override
	public int compareTo(Day other) {
		final int BEFORE = -1;
		final int EQUAL = 0;
		final int AFTER = 1;
		
		if (this.getRange() < other.getRange()) {
			return BEFORE;
		} else if (this.getRange() ==  other.getRange()) {
			return EQUAL;
		} else {
			return AFTER;
		}
	}

}
